#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
    int seed = 500;
    int numPlayer = 2;
    int p, r, handCount;
	int x;
	int y = 0;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    int maxHandCount = 5;

	memset(&G, 23, sizeof(struct gameState));   // clear the game state
	r = initializeGame(numPlayer, k, seed, &G); // initialize a new game

	/* draws card for player 0, discards card for player 1, and repeat 5 times and print how many
		cards are in the player's hand each time */
    printf ("TESTING numHandCards():\n");
    for (p = 0; p < numPlayer; p++)
    {
        for (handCount = 1; handCount <= maxHandCount; handCount++)
        {
			x = numHandCards(&G);
			#if (NOISY_TEST == 1)
				printf("Player %d, Number of Cards in Hand: %d\n", p, x);
			#endif
			if (y == 0) { drawCard(p, &G); } // for player 1, draw cards
			else if (y == 1) { discardCard(0, p, &G, 0); } // for player 2, discard first card
	
        }
		printf("\n");
		y = 1;
		endTurn(&G);
    }

    printf("All numHandCards tests completed!\n");

    return 0;
}
